// AppEventRecord.cpp: implementation of the AppEventRecord class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AppEventRecord.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

AppEventRecord::AppEventRecord()
:m_hEventSource(NULL)
{
	m_hEventSource = ::RegisterEventSource(NULL,"MYEVENT");
}

AppEventRecord::~AppEventRecord()
{
	if(m_hEventSource != NULL)
		::DeregisterEventSource(m_hEventSource);  
}

void AppEventRecord ::put(const char* str)
{
			
	if(m_hEventSource   !=   NULL)   
	{   
		//   Write   to   event   log.   
		::ReportEvent(m_hEventSource,
			EVENTLOG_INFORMATION_TYPE,
			0,
			0,
			NULL,
			1,
			0,
			&str,
			NULL);   
	}
}

